﻿@model CNRegex.Web.Models.ModelTutorialTemplate

<link href="@Url.Content("~/Content/css/TutorialTemplate_Catalog.css")" rel="stylesheet" type="text/css" />
<div class="ttr_catalog">
	<ul class="ttr_categoryTitle">
		<li>索引目录</li>
	</ul>
	<ul class="ttr_catalog_ul">
		@{
			var level0 =  Model.TutorialCatalog.Where(x=>x.Level==0).ToList();
		}
		@for (int i = 0; i < level0.Count(); i++)
	{
		<li class="ttr_catalog_li">
			<a href="javascript:expend(@i)" class="ttr_catalog_link" style="color:Black;">
				@level0[i].Name
			</a>
			@{
		var level1 = Model.TutorialCatalog.Where(x => x.ParentID == level0[i].ID).ToList();
	   }
			<ul class="ttr_subCatalog" @Html.Raw(string.Format("id='ul{0}'",i))>
				@for (int j = 0; j < level1.Count(); j++)
				{
					<li>
						<a href="/@Model.ExcuteControllerName/@Model.ExcuteActionName/@level1[j].ID">@level1[j].Name</a>
					</li>
				}
			</ul>
		</li>
	}
	</ul>
</div>
<script type="text/javascript">
	function expend(id) {
		if ($("#ul" + id).css("display") == "block") {
			$("#ul" + id).fadeOut("slow");
		} else {
			$("#ul" + id).fadeIn("slow");
		}
	}
</script>
